package com.qianxun.module.application.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianxun.module.application.entity.Application;
import com.qianxun.module.application.mapper.ApplicationMapper;
import com.qianxun.module.application.service.ApplicationService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * 应用业务处理类
 *
 * @author Admin
 */
@Service
public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Application> implements ApplicationService {

    @Override
    public Application getByAppId(String appId) {
        LambdaQueryWrapper<Application> wrapper = new QueryWrapper<Application>().lambda();
        wrapper.eq(Application::getAppId, appId);
        return this.getOne(wrapper);
    }

    @Override
    public List<Application> queryByPid(Integer pid, List<String> codes) {
        LambdaQueryWrapper<Application> wrapper = new QueryWrapper<Application>().lambda();
        wrapper.eq(Application::getPid, pid);
        wrapper.in(Objects.nonNull(codes), Application::getAppId, codes);
        return this.list(wrapper);
    }

}
